package c.c.c.a.i.a;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;

/* compiled from: BatteryWatcher */
public class d {
    public int a;

    /* compiled from: BatteryWatcher */
    public class b extends BroadcastReceiver {
        public b(a aVar) {
        }

        public void onReceive(Context context, Intent intent) {
            if ("android.intent.action.BATTERY_CHANGED".equals(intent.getAction())) {
                d.this.a = (int) ((((float) intent.getIntExtra("level", 0)) * 100.0f) / ((float) intent.getIntExtra("scale", 100)));
            }
        }
    }

    public d(Context context) {
        try {
            context.registerReceiver(new b(null), new IntentFilter("android.intent.action.BATTERY_CHANGED"));
        } catch (Throwable unused) {
        }
    }
}
